#ifndef __XMLTV_STUFF
#define __XMLTV_STUFF

/*
 *   This file is part of ed_pvr.
 *
 *   ed_pvr is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   ed_pvr is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with ed_pvr.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifdef __cplusplus
    extern "C" {
#endif

#include <stdint.h>
#include <inttypes.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xmlreader.h>
#include <sys/stat.h>
#include "timers.h"

struct xmltv_compressed_file_struct
{
	void *context;
	FILE *fp;
};
typedef struct xmltv_compressed_file_struct XMLTV_COMPRESSED_FILE_STRUCT;

struct xmltv_strings_struct
{
	uint8_t count;
	xmlChar	*strs[255];
};
typedef struct xmltv_strings_struct XMLTV_STRINGS_STRUCT;

struct xmltv_struct
{
//	int	use_cache;
	int cached;
	struct stat file_stat;
	char *filename;
	xmlDocPtr doc;
	xmlTextReaderPtr reader;
};
typedef struct xmltv_struct XMLTV_STRUCT;

XMLTV_STRUCT * xmltv_init(char *);
void xmltv_cleanup(XMLTV_STRUCT *);
xmlXPathObjectPtr xmltv_getnodeset(xmlDocPtr, xmlChar *);
//xmlChar * xmltv_get_channel_display(XMLTV_STRUCT *, char *);
XMLTV_STRINGS_STRUCT * xmltv_get_channel_display(XMLTV_STRUCT *, char *);
xmlChar * xmltv_get_program_title(XMLTV_STRUCT *, char *, char *);
xmlChar * xmltv_get_program_subtitle(XMLTV_STRUCT *, char *, char *);
xmlChar * xmltv_get_program_category(XMLTV_STRUCT *, char *, char *);
xmlChar * xmltv_get_program_desc(XMLTV_STRUCT *, char *, char *);
xmlNodePtr xmltv_get_id_and_times(XMLTV_STRUCT *, char *, char *, char *);
xmlChar * xmltv_get_episode_dd(XMLTV_STRUCT *, char *, char *, char *);
xmlChar *xmltv_get_content_from_ptr(xmlNodePtr);
xmlNodePtr xmltv_get_episode_dd_nodeptr(XMLTV_STRUCT *, char *);

TIMER_STRUCT * xmltv_get_epg_list(XMLTV_STRUCT *, char *, uint64_t, uint64_t);
xmlNodePtr xmltv_get_channel(XMLTV_STRUCT *);
#ifdef __cplusplus
    }
#endif


#endif

